package com.chz.SupermarketMS.controllers;

import com.chz.SupermarketMS.dao.PurchaseRepository;
import com.chz.SupermarketMS.dao.SaleRepository;
import com.chz.SupermarketMS.dao.UserAccountRepository;
import com.chz.SupermarketMS.entities.*;
import com.chz.SupermarketMS.service.UserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@RequestMapping("userAccounts")
public class UserAccountController {
    @Autowired
    UserAccountRepository userAccountRepository;

    @Autowired
    UserAccountService userAccountService;

    @GetMapping
    public String  displayUserAccounts(Model model){
        List<UserAccount> userAccounts=userAccountRepository.findAll();
        model.addAttribute("userAccounts",userAccounts);
        return "userAccounts/userAccounts";
    }



}
